package com.lcw.api.user.rest;

import com.lcw.api.user.bean.User;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("user")
public class UseRestController {

    @GetMapping("/{id}")
    public User get(@PathVariable String id){
        User user = new User();
        user.setPassword("p123");
        user.setUserName("u123");
        return user;
    }

    @GetMapping("/")
    public List<User> list() {
        List<User> userList = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            User user = new User();
            user.setPassword("p123");
            user.setUserName("u123");
            userList.add(user);
        }
        return userList;
    }
}
